import Mock from 'mockjs'

const BASE_URL = ''


export default [{
		url: `${BASE_URL}/abnormalAndWork`,
		type: 'get',
		response: config => {
			return {
				code: 200,
				data: {
					value: '我进行一下测试，看看数据',
					data: [],
				}
			}
		}
	},
	{
		url: `${BASE_URL}/SafetyOrderIndex.asmx/getSafetyData`,
		type: 'post',
		response: config => {
			const {
				page,
				limit,
				nodeId,
				date
			} = config.query
			const count = 100;
			let List = []
			for (let i = 0; i < count; i++) {
				List.push(Mock.mock({
					id: '@increment',
					enterprise: "@ctitle",
					enterpriseid: "@increment",
					abnormalCount: "@natural(1,999)",
					"handleTime|1-24": 1,
					"supervisionCount|1-24": 1,
					"score|1-100": 1
				}))
			}
			List.sort((a, b) => b.score - a.score)
			const safetyTableList = limit ? List.filter((item, index) => index < limit * page && index >= limit * (page - 1)) : List
			return {
				code: 200,
				data: {
					safetyTableList,
					total: List.length
				}
			}
		}
	},
	{
		url: `${BASE_URL}/SafetyOrderDetail.asmx/getSafetyDetail`,
		type: 'post',
		response: config => {
			const {
				nodeId,
				id,
				date
			} = config.query
			let List = []
			for (let i = 0; i < 5; i++) {
				List.push(Mock.mock({
					id: "@increment",
					enterprise: "@ctitle",
					"abnormalType|1": ["超标异常", "某个异常"],
					time: "@datetime('yyyy-MM-dd A HH:mm:ss')",
					minute: "@natural(1,240)",
					"isSuperise|1": ["否", "是"],
					"isHandle|1": ["是", "否"]
				}))
			}
			let detailData = {
				summation: {
					abnormalType: "-2",
					time: "-",
					minute: "-",
					isSuperise: "-2"
				},
				explain: "本企业在该统计时间内异常数为(B)，督办数为（C），统计时间内所有企业一共有（D）个异常，（E）个督办，每个异常得分为100/D，每个督办得分为100/E;\n所以本企业得分为{100-{(B*100/D)}}*0.3+{100-{C*(100/E)}}*0.7",
				detaliList: List

			}
			return {
				code: 200,
				msg: "获取成功",
				data: detailData
			}
		}
	},
	{
		url: `${BASE_URL}/HistoryAlarmIndex.asmx/getSupervisionTableList`,
		type: 'post',
		response: config => {
			const {
				page,
				limit,
				nodeId,
				date
			} = config.query
			const count = 100;
			let List = []
			for (let i = 0; i < count; i++) {
				List.push(Mock.mock({
					id: '@increment',
					enterprise: "@ctitle",
					legalPerson: "@cname",
					"sourceCode|1-999999": 1,
					abnormalType: "超标报警",
					chargeDepartment: "XXXXxX",
					abnormalTime: "@datetime('yyyy-MM-dd A HH:mm:ss')",
					abnormalTotalTime: "5"
				}))
			}

			const supervisionTableList = limit ? List.filter((item, index) => index < limit * page && index >= limit * (page - 1)) : List
			return {
				code: 200,
				data: {
					supervisionTableList,
					total: List.length
				}
			}
		}
	},
	{
		url: `${BASE_URL}/HistoryData.asmx/getHistoryList`,
		type: 'post',
		response: config => {
			const {
				page,
				limit,
				nodeId,
				startTime,
				endTime,
				status
			} = config.query
			const count = 100;
			let List = []
			for (let i = 0; i < count; i++) {
				List.push(Mock.mock({
					id: '@increment',
					enterprise: "@ctitle",
					"applicationType|1": ["超标异常", "某个异常"],
					"dose|1-100": 1,
					"status|1": ["状态1", "状态2"],
					"sourceType|1": ["固定源", "固定源"],
					nucleusName: "@ctitle",
					"sourceCode|1-999999": 1,
					chargeDepartment: "XXXXxX",
					colletTime: "@datetime('yyyy-MM-dd A HH:mm:ss')",
				}))
			}

			const historyList = limit ? List.filter((item, index) => index < limit * page && index >= limit * (page - 1)) : List
			return {
				code: 200,
				data: {
					historyList,
					total: List.length
				}
			}
		}
	},
	{
		url: `${BASE_URL}/HistoryAlarmIndex.asmx/getAbnormalList`,
		type: 'post',
		response: config => {
			const {
				page,
				limit,
				nodeId,
				startTime,
				endTime
			} = config.query
			const count = 100;
			let List = []
			for (let i = 0; i < count; i++) {
				List.push(Mock.mock({
					id: '@guid',
					enterprise: "@ctitle",
					nucleusName: "@cname",
					"sourceCode|1-999999": 1,
					"abnormalType|1": ["超标异常", "某个异常"],
					"applicationType|1": ["超标异常", "某个异常"],
					"thenDose|1-100": 1,
					"abnormalSite|1": ["无锡市", "常州市", "苏州市"],
					"sourceType|1": ["固定源", "固定源"],
					abnormalTime: "@datetime('yyyy-MM-dd A HH:mm:ss')",
					status: i % 2 == 0 ? "正常" : "异常"
				}))
			}

			const abnormalList = limit ? List.filter((item, index) => index < limit * page && index >= limit * (page - 1)) : List
			return {
				code: 200,
				data: {
					abnormalList,
					total: List.length
				}
			}
		}
	},
	{
		url: `${BASE_URL}/nuclearSafetyRanking/getStockRecordList`,
		type: 'post',
		response: config => {
			const {
				page,
				limit,
				nodeId,
				startTime,
				endTime
			} = config.query
			const count = 100;
			let List = []
			for (let i = 0; i < count; i++) {
				List.push(Mock.mock({
					id: '@increment',
					"status|1": ["出库", "入库"],
					"dose|1-12": 1,
					stockTime: "@datetime('yyyy-MM-dd A HH:mm:ss')",
					"sourceCode|1-999999": 1
				}))
			}

			const stockRecordList = limit ? List.filter((item, index) => index < limit * page && index >= limit * (page - 1)) : List
			return {
				code: 200,
				data: {
					stockRecordList,
					total: List.length
				}
			}
		}
	},
	{
		url: `${BASE_URL}/nuclearSafetyRanking/getSourceRecordList`,
		type: 'post',
		response: config => {
			const {
				page,
				limit,
				nodeId,
				startTime,
				endTime
			} = config.query
			const count = 100;
			let List = []
			for (let i = 0; i < count; i++) {
				List.push(Mock.mock({
					id: '@increment',
					"originalStatus|1": ["状态", "原状态"],
					"nowStatus|1": ["状态", "现状态"],
					"dose|1-12": 1,
					changeTime: "@datetime('yyyy-MM-dd A HH:mm:ss')",
					"sourceCode|1-999999": 1
				}))
			}

			const sourceRecordList = limit ? List.filter((item, index) => index < limit * page && index >= limit * (page - 1)) : List
			return {
				code: 200,
				data: {
					sourceRecordList,
					total: List.length
				}
			}
		}
	},
	{
		url: `${BASE_URL}/AlarmNotice.asmx/getAlarmNotice`,
		type: 'post',
		response: config => {
			const {
				nodeId,
				id,
				date
			} = config.query
			let detailData = {
				abnormalFactor: "", // 接警升级（小时）时间
				focusType: [], // 关注类型
				noticePerson: "", // 通知人员
				noticePhone: "", // 通知手机
				acceptScope: "", // 接受范围
				noticePersonOne: "", // 第一次升级人员名称
				noticePhoneOne: "", // 第一次升级通知手机
				acceptScopeOne: "", // 第一次升级接受范围
				noticePersonTwo: "", // 第一次升级人员名称
				noticePhoneTwo: "", // 第一次升级通知手机
				acceptScopeTwo: "" // 第二次升级接受范围

			}
			return {
				code: 200,
				msg: "获取成功",
				data: detailData
			}
		}
	},
]
